# nodemon --watch fetcher/02request_gameName.py --exec 'uv run fetcher/02request_gameName.py'
import requests

game_title = input('enter a game key:')
#字典需要存放请求携带的所有的请求参数
params = {
'q':game_title
} #请求参数的数量和字典的键值对的数量保持⼀致

url = 'https://game.51.com/search/action/game/'
resp = requests.get(url,params)
resp.encoding = 'UTF-8' # fix 中文乱码
# print(resp.text)

with open('./tmp/games.html', 'w', encoding='UTF-8') as f:
    f.write(resp.text)
    